package see.battle.object;

import see.battle.Const;
import see.battle.drawer.Drawer;

public class Background implements MovableGameObject {

  private Drawer _drawer;
  private int _objectId;
  private float _position;
  private float _maxLeftPosition;
  private float _minLeftPosition;

  /**
   * @param drawer
   * @param type
   */
  public Background(Drawer drawer, int type) {
    _drawer = drawer;
    _objectId = _drawer.getBackgroundId(type);
    _position = Const.backgroundLeft;
    _maxLeftPosition = 0;
    _minLeftPosition = 1 + Const.backgroundLeft - Const.backgroundRight;
  }

  public float get_position() {
    return _position;
  }

  //@Override
  public void draw() {
    _drawer.draw(_objectId, _position, 0);
  }

  //@Override
  public void moveTo(float position) {
    _position = position;
    if (_position < _minLeftPosition) _position = _minLeftPosition;
    if (_position > _maxLeftPosition) _position = _maxLeftPosition;
  }
}